/**
 * 充值列表 add by gsh
 */
$(function() {
	// 全选
	$("#chkAll").change(function() {
		var chkStatus = $(this).is(":checked");
		$("[id^=chk]:not(#chkAll)").each(function() {
			this.checked = chkStatus;
		});
	});

});

function getChecked() {
	var map = $("[id^=chk]:not(#chkAll)").map(function() {
		if (this.checked)
			return this.value;
	});
	return map.get();
}

function viewUser(id) {
	var index = msgWnd.open({
		title : "查看用户信息",
		skin : 'layui-layer-lan',
		type : 2,
		shade : 0.5,
		area : [ "510px", "550px" ],
		maxmin : true,
		content : '/user/view/' + id,
		zIndex : layer.zIndex
	});	
}

//通过
function pass(id) {
	var index = msgWnd.confirm("确认通过吗?", {
		title : "审核管理员帐户操作",
		skin : 'layui-layer-lan',
		btn : [ "确定", "取消" ],
		icon : 1
	}, function() {	
		$.ajax({
			type : "POST",
			url : "/account/change/audit/manager/pass/"+id,
			dataType : "json",
			success : function(msg) {
				if (msg.data.status >0) {
					msgTools.alert("审核管理员帐户操作", msg.data.msg, 1000);
					if(typeof(reloadPg)!="undefined")
						reloadPg();
					else
						window.location.href = window.location.href;
				} else {
					msgTools.alert("审核管理员帐户操作", msg.data.msg, 2000);
				}
			}
		});
	});
}

//拒绝
function refuse(id) {
	var index = msgWnd.confirm("确认拒绝吗?", {
		title : "审核管理员帐户操作",
		skin : 'layui-layer-lan',
		btn : [ "确定", "取消" ],
		icon : 1
	}, function() {		
		$.ajax({
			type : "POST",
			url : "/account/change/audit/manager/refuse/"+id,
			dataType : "json",
			success : function(msg) {
				if (msg.data.status >0) {
					msgTools.alert("审核管理员帐户操作", msg.data.msg, 1000);
					if(typeof(reloadPg)!="undefined")
						reloadPg();
					else
						window.location.href = window.location.href;				
				} else {
					msgTools.alert("审核管理员帐户操作", msg.data.msg, 2000);
				}
			}
		});
	});
}

function batchPass(){
	var idList=getChecked();
	if(idList!=null && idList.length>0)idList=idList.join("_");	
	else{
		msgTools.alert("错误", "请选择要操作的记录！", 1000);
		return;
	}
	var index = msgWnd.confirm("确认通过吗?", {
		title : "审核管理员帐户操作",
		skin : 'layui-layer-lan',
		btn : [ "确定", "取消" ],
		icon : 1
	}, function() {	
		$.ajax({
			type : "POST",
			url : "/account/change/audit/manager/pass/batch/"+idList,
			dataType : "json",
			success : function(msg) {
				if (msg.data.status >0) {
					msgTools.alert("审核管理员帐户操作", msg.data.msg, 1000);
					if(typeof(reloadPg)!="undefined")
						reloadPg();
					else
						window.location.href = window.location.href;
				} else {
					msgTools.alert("审核管理员帐户操作", msg.data.msg, 2000);
				}
			}
		});
	});
}